#include "DrawRectangle.h"

DrawRectangle::DrawRectangle(void)
{
}

DrawRectangle::~DrawRectangle(void)
{
	SDL_FreeSurface(screen);
	SDL_Quit();
}

void DrawRectangle::run()
{
	const int WINDOW_WIDTH = 800;
	const int WINDOW_HEIGHT = 600;
	const char* WINDOW_TITLE = "Sample Rectangle";

	SDL_Init( SDL_INIT_VIDEO );

	screen = SDL_SetVideoMode( WINDOW_WIDTH, WINDOW_HEIGHT, 0, 
      SDL_HWSURFACE | SDL_DOUBLEBUF );
	SDL_WM_SetCaption( WINDOW_TITLE, 0 );

	rectangle.x = 20;
	rectangle.y = 20;
	rectangle.w = 100;
	rectangle.h = 80;

	SDL_FillRect(screen, NULL, SDL_MapRGB(screen->format, 251, 189, 74));
	SDL_FillRect(screen, &rectangle, SDL_MapRGB(screen->format, 210, 55, 20));
	SDL_Flip(screen);

	SDLSample::handleEvents();
}
